<!--
+----------------------------------------------------------------------
| 友得云客  - 开启房产营销新纪元
+----------------------------------------------------------------------
| Copyright (c) 2019~2023 优得（西安）信息科技有限公司版权所有
+----------------------------------------------------------------------
| Licensed 友得云客不是自由软件 未经允许不可移除相关版权
+----------------------------------------------------------------------
| Author: www.youdeyunke.com
+----------------------------------------------------------------------
-->
<template>
    <el-dialog title="请选择结束原因" :destroy-on-close="true" :visible.sync="show" width="400px">
 
                <el-radio-group v-model="reason">
                    <el-radio label="撤回">撤回</el-radio>
                    <el-radio label="终止">终止</el-radio>
                </el-radio-group>

        <span slot="footer" class="dialog-footer">
            <el-button size="mini" type="default" icon="el-icon-close" @click="() => { this.show = false }" :disabled="loading">取消</el-button>
            <el-button size="mini" type="primary" icon="el-icon-check" @click="submitHandle" :disabled="loading">确定</el-button>
        </span>
    </el-dialog>
</template>

<style lang="scss" scoped></style>

<script>

import { updateAuctionHouseStatus } from "@/api/auctionhouse";

export default {
    components: {
    },
    props: {
    },

    data() {
        return {
            show: false,
            reason: '',
            loading: false,
            item: null,
        };
    },

    watch: {

    },

    created: function () {

    },
    computed: {},


    methods: {
        submitHandle: async function () {
            this.loading = true
            updateAuctionHouseStatus({
                id: this.item.id,
                status: this.reason
            }).then(res => {
                this.loading = false
                if (res.code != 0) {
                    return
                }
                this.show = false
                this.$message.success('更新成功')
                // this.qr = res.data
                this.$emit('refresh')
            }).catch((err) => {
                this.loading = false
                console.log(err);
            })
        },

        openDialog: function (item) {
            console.log('qr is, ', item)
            this.show = true
            this.item = item
            // this.qr = item.qr
            // this.hid = item.id
        },

    },
};
</script>
<style scoped>
.outer {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}
</style>